function MessEventUtil() {

    this.eventTypes = new Map();

    this.fillEventTypesMap();

    // event constants
	this.MOUSE_MOVE       = "mousemove";
	this.MOUSE_UP         = "mouseup";
	this.MOUSE_OVER       = "mouseover";
	this.MOUSE_OUT        = "mouseout";
	this.MOUSE_DOWN       = "mousedown";
	this.MOUSE_CLICK      = "click";
    this.MOUSE_DBL_LCLICK = "dblclick";
    this.MOUSE_WHEEL      = "mousewheel";

};

    /**
    * Fill map of supported event types
    *
    */
    MessEventUtil.prototype.fillEventTypesMap = function() {

        // mousemove
        this.eventTypes.put("mousemove",  new MessEventType("mousemove",  "onmousemove"));
        this.eventTypes.put("mouseup",    new MessEventType("mouseup",    "onmouseup"));
        this.eventTypes.put("mouseover",  new MessEventType("mouseover",  "onmouseover"));
        this.eventTypes.put("mouseout",   new MessEventType("mouseout",   "onmouseout"));
        this.eventTypes.put("mousedown",  new MessEventType("mousedown",  "onmousedown"));
        this.eventTypes.put("click",      new MessEventType("click",      "onclick"));
        this.eventTypes.put("dblclick",   new MessEventType("dblclick",   "dblclick"));
        this.eventTypes.put("mousewheel", new MessEventType("DOMMouseScroll","onmousewheel"));

    }

    /**
	* Cross-browser event attaching method
	*
	* @public
	* @method  addEventHandler
	* @param    {Object} target    target object that will have the event attached
	* @param    {String} type      string describing event type
	* @param    {String} handler   event handling method
	*/
	MessEventUtil.prototype.addEventHandler = function(target, type, handler) {

        if (target.addEventListener) {
		// DOM-compliant browser
			MessEventUtil.prototype.addEventHandler = function(target, type, handler) {
                                                        target.addEventListener(this.getEventType(target, type), handler, false);
                                                      };

            target.addEventListener(this.getEventType(target, type), handler, false);
		}
		else if (target.attachEvent) {
		// Microsoft browser
			MessEventUtil.prototype.addEventHandler = function(target, type, handler) {
                                                        target.attachEvent(this.getEventType(target, type), handler);
                                                      };

            target.attachEvent(this.getEventType(target, type), handler);
		}
		else {
		// other browsers
			MessEventUtil.prototype.addEventHandler = function(target, type, handler) {
                                                        target[this.getEventType(target, type)] = handler;
                                                      };
            
            target[this.getEventType(target, type)] = handler;
		}
	};
	
	/**
	* Cross-browser method returning event object
	*
	* @public
	* @method  getEventObject
	* @return  {Object}  browser specific event object
	*/
	MessEventUtil.prototype.getEvent = function() {
		
		if (window.event) {
		// Miscrosoft event mode
			MessEventUtil.prototype.getEvent = function() { return window.event; };
			return window.event;
		}
		else {
		// possibly DOM compliant browser
			MessEventUtil.prototype.getEvent = function(a) { return MessEventUtil.prototype.getEvent.caller.arguments[0]; };
			return MessEventUtil.prototype.getEvent.caller.arguments[0];
		}
	};
	
	/**
	* Gets event source HTML element reference
	*
	* @public
	* @method  getSource
	* @param    {Object} event
	* @return  Object
	*/
	MessEventUtil.prototype.getSource = function(oEvent) {

        MessEventUtil.prototype.getSource = function(oEvent) {
            var src = this.getSourceFromEvent(oEvent);
            oEvent.srcElement;
            var idArray = src.id.split(":");
            return document.getElementById(idArray[0]);
        };

        var src = this.getSourceFromEvent(oEvent);
        var idArray = src.id.split(":");
        return document.getElementById(idArray[0]);
    }

    /**
     * Get event source element - browser dependent method
     *
     * @param  {Event}  oEvent raised by source dom element
     * @return {DOM}    source element
     */
    MessEventUtil.prototype.getSourceFromEvent = function(oEvent) {

        if (oEvent.srcElement) {
        // microsoft browser
            MessEventUtil.prototype.getSourceFromEvent = function(oEvent) {
                return oEvent.srcElement;
            }
            return oEvent.srcElement;
        }
        else if (oEvent.target) {
        // DOM browser
            MessEventUtil.prototype.getSourceFromEvent = function(oEvent) {
                return oEvent.target;
            }
            return oEvent.target;
        }
    }

    /**
	* Stops event propagation
	*
	* @public
	* @method stopEvent
	* @param  {Object} event
	*/
	MessEventUtil.prototype.stopEvent = function(oEvent) {
	
		if (oEvent.stopPropagation) {
			oEvent.stopPropagation;
		}
		else {
			oEvent.cancelBubble = true;
		}
	}
	
	/**
	* Clears any selection on page
	*
	* @public
	* @method clearSelection
	*/
	MessEventUtil.prototype.clearSelection = function() {
		
		if (document.selection) {
		// Microsoft browser
			document.selection.empty();
		}
		else if (window.selection) {
		// DOM browser
			window.selection.empty();
		}
	}
	
	/**
	 * Basic Events attaching logic
	 * 
	 * @private
	 * @method  attachBasicEventHandlers
	 */	
	 MessEventUtil.prototype.attachBasicEventHandlers = function() {
	 	
	 	// onresize event on body element
	 	eventUtil.addEventHandler(window, "resize", MessEventUtil.prototype.bodyOnResizeHandler);
	 };
	 
	/**
	 * Handles body resizing event
	 * 
	 * @event
	 * @method  bodyOnResizeHandler
	 */
	MessEventUtil.prototype.bodyOnResizeHandler = function() {
		
		// get reference to root panel and run resizing logic
		env.getRootPanel().updatePanelSize();
	};


    /**
    * Returns browser specific event type string
    *
    * @private
    * @method  getEventType
    * @return  {String}  event type string supported by running browser
    */
    MessEventUtil.prototype.getEventType = function(target, type) {

        if (target.addEventListener) {
        // DOM compliant browser
            return this.eventTypes.get(type).getDOMType();
		}
		else if (target.attachEvent) {
		// Microsoft browser
            return this.eventTypes.get(type).getIEType();
		}
		else {
		// other browsers
			return this.eventTypes.get(type).getIEType();
		}
    }

    /**
     * Disables textSelection event on specified element
     *
     * @param element  element we want to be blind for this event
     */
    MessEventUtil.prototype.disableTextSelectionEvent = function(element) {

        element.onselectstart = function() { return false; };
        element.unselectable = "on";
        element.style.MozUserSelect = "none";
        element.style.cursor = "default";
    }



